function classRoom(username,hotelname,group){
    var obj = new Object(); 
    obj.arrRoom = new Object();
    obj.arrRoomPrice = new Object();
    obj.arrProductPrice = new Object();
    obj.arrAction = new Object();
    obj.flgAction = false;
    obj.arrProductAdd = new Array();
    obj.arrProductRemove = new Array();
    obj.arrRoomMove = new Array();
    obj.username = username;
    obj.hotelname = hotelname;
    obj.group = group;
    obj.saturdayadd = 0; // gia tang theo ngay thu 7
    obj.sundayadd = 0; // gia tang theo  chu nhat 
    obj.indexNewProduct = 0;
    obj.arrCustomer = new Object();
    obj.startTime  =  7;
    obj.endTime = 12;   
    obj.flgCal = 1;   
    //id : id cua phong
    //roomtype: loai phong
    //timestamp: thoi gian da thue tinh bang giay
    //status : trang thai phong dang thue hay khong
    
    obj.setConfigure= function(saturdayadd,sundayadd,startTime,endTime,flgCal){
        obj.saturdayadd = 0; // gia tang theo ngay thu 7
        obj.sundayadd = 0; // gia tang theo  chu nhat 
        obj.indexNewProduct = 0;
        obj.arrCustomer = new Object();
        obj.startTime  =  7;
        obj.endTime = 12;   
        obj.flgCal = 1;   
    }
    obj.setTimeRoom=function(start,end){
        obj.startTime = start;
        obj.endTime = end;
    }
    obj.setaddDate =function (saturday,sunday){
        obj.saturdayadd = saturday;
        obj.sundayadd = sunday;
    }
    
    //obj.initCustomer = function(strRoom){
//        var arrRoom = strRoom.split(',');
//        for(i=0;i<arrRoom.length;i++){
//          obj.arrCustomer[arrRoom[i]]= new Object();  
//        }        
//    }
//    
//    obj.initSetCustomer = function(){
//        for(var i in obj.arrRoom){
//         obj.arrCustomer[i]= new Object();   
//        }
//     }
//    
//    obj.assignNewCustomer= function(room_id,name,cmnd,age,address,sex,moto){
//        obj.arrCustomer[room_id][obj.indexNewProduct]=obj.addCustomer(name,cmnd,age,address,sex,moto);
//        current_id = obj.arrRoom[room_id].current_id;
//        xajax_htfrmmanagerhotel_saveCustomer(current_id,name,cmnd,age,address,sex,moto,obj.indexNewProduct);
//        obj.indexNewProduct++;        
//    }
//    
//     obj.assignOldCustomer= function(room_id,dum_id,name,cmnd,age,address,sex,moto){        
//        obj.arrCustomer[room_id][dum_id]=obj.addCustomer(name,cmnd,age,address,sex,moto);
//    }
//    
//    obj.addCustomer = function(name,cmnd,age,address,sex,moto){
//        var obj = new Object();        
//        obj.name = name;
//        obj.cmnd = cmnd;
//        obj.age = age;
//        obj.address = address;
//        obj.moto = moto;
//        obj.sex = sex;        
//        return(obj);
//    }
    
    obj.resetAction = function(){
        obj.flgAction = false;
        obj.arrProductAdd = new Array();
        obj.arrProductRemove = new Array();
        obj.arrRoomMove = new Array(); 
    }
    
    obj.addProduct = function(pro_id,current_id){
        try{
           // abc= 1/0;
            var nameid=  pro_id +';'+ current_id;
            if(typeof obj.arrProductRemove[nameid] != 'undefined'){
                var nump = obj.arrProductRemove[nameid] ;
                if(nump > 0){
                  obj.arrProductRemove[nameid] = nump-1;
                  return;
                  
                }
            }
            if(typeof obj.arrProductAdd[nameid] != 'undefined'){
                    var nump = obj.arrProductAdd[nameid];
                    obj.arrProductAdd[nameid] =  nump+1;
             }else{
                obj.arrProductAdd[nameid] = 1;
             }   
        }catch(err){
             txt="There was an error on this page.\n\n";
              txt+="Error description: " + err.message + "\n\n";
              txt+="Click OK to continue.\n\n";
              alert(txt);
            return;
        }        
    }
        
    obj.removeProduct = function(pro_id,current_id){
        try{
            var nameid=  pro_id +';'+ current_id;
            if(typeof obj.arrProductAdd[nameid] != 'undefined'){
                var nump = obj.arrProductAdd[nameid] ;
                if(nump > 0){
                  obj.arrProductAdd[nameid] = nump-1;
                  return;
                }
            }
            if(typeof obj.arrProductRemove[nameid] != 'undefined'){
                    var nump = obj.arrProductRemove[nameid];
                    obj.arrProductRemove[nameid] =  nump+1;
            }else{
                obj.arrProductRemove[nameid] = 1;
            }   
        }catch(err){
            return;
        }        
    }
    
    obj.moveRoom= function(fromroom,toroom){
        nametorom = fromroom+';' +toroom;
        for(var i in obj.arrRoomMove){
            var arrName =  i.split(';');
            preFromRoom = arrName[0];
            preToRoom = arrName[1];
            if(preToRoom==fromroom){
              obj.arrRoomMove[i]=false;
              nametorom = preFromRoom+';'+ toroom;
              break; 
            }
        }
       obj.arrRoomMove[nametorom]=true;  
    }
    
    obj.createRoomObj=function(name,roomtype,timestamp,status,current_id)
    {
        var obj = new Object();        
        obj.name = name;
        obj.current_id = current_id;
        obj.roomtype = roomtype;
        obj.timestamp = timestamp;
        obj.status = status;
        return(obj);
    }

    obj.createAssignRoom = function(id,name,roomtype,timestamp,status,current_id){
        obj.arrRoom[id] = obj.createRoomObj(name,roomtype,timestamp,status,current_id);
    }
    
    obj.createAssignStatus = function(id,timestamp,status,current_id){
        //alert(status);
        obj.arrRoom[id].timestamp = timestamp;
        obj.arrRoom[id].status = status;
        obj.arrRoom[id].current_id = current_id;
        if(status==1){
           // $('#htfrmmanagerhotel_div_'+id).append('<table width="100%" ><tr class="trheader"><th width="70%">sanpham</th><th width="10%">sl</th><th width="10%"><img  src="images/product/minus_single.ico" title="Bot mot san pham"/ width="10" height="10"></th><th width="10%"><img  src="images/product/plus_blue.ico" title="Bot mot san pham"/ width="10" height="10"></th></tr></table>');
            $('#htfrmmanagerhotel_div_'+id).append('<table width="100%" ></table>');
          $('#htfrmmanagerhotel_div_'+id).css('display',''); 
        }else{
           $('#htfrmmanagerhotel_div_'+id).css('display','none');   
        }
        
         //obj.createRoomObj(name,roomtype,timestamp,status,current_id);
    }
    
 //name :ten loai phong
//price1: gia tu 0-1 gio
//price2: gia tu 1-2 gio
//price3: gia tu 2-3 gio
//price4: gia tu 3-4 gio
//price5: gia tu 4-5 gio
//priceday: gia tu trong ngay

obj.createRoomPriceObj= function(name,price1,price2,price3,price4,price5,priceDay,color){
    var obj = new Object();
    obj.name = name;        
    obj.price1 = price1;
    obj.price2 = price2;
    obj.price3 = price3;
    obj.price4 = price4;
    obj.price5 = price5;
    obj.priceDay = priceDay;
    obj.color = color;
    return(obj);
}

obj.createAssignRoomPrice = function(roomtype,name,price1,price2,price3,price4,price5,priceDay,color){
    obj.arrRoomPrice[roomtype] = obj.createRoomPriceObj(name,price1,price2,price3,price4,price5,priceDay,color);
}

// name : ten san pham
// price: gia san pham
// unit : don vi tinh(1)
// unitname : ten don vi tinh (chai, goi)
obj.createProductPriceObj= function(name,price,unit,unitname){
    var obj = new Object();        
    obj.name = name;
    obj.price = price;
    obj.unit = unit;
    obj.unitname = unitname;
    return(obj);
}

obj.createAssignProductPrice = function(id,name,price,unit,unitname){
    obj.arrProductPrice[id] = obj.createProductPriceObj(name,price,unit,unitname);
}

// user name : username
// hotel name : ten khach san
// group : nhom cua khach san

obj.SetInfo= function (username,hotelname,group){        
    obj.username = username;
    obj.hotelname = hotelname;
    obj.group = group;
}
obj.setFlag=function(flg){
  obj.flgAction = flg;   
}    
   return obj;
    
}

 function setConfigure(saturdayadd,sundayadd,startTime,endTime,flgCal){
     if(typeof (ht_obj) != 'undefined'){
        ht_obj.saturdayadd = saturdayadd; // gia tang theo ngay thu 7
        ht_obj.sundayadd = sundayadd; // gia tang theo  chu nhat 
        ht_obj.startTime  =  startTime;
        ht_obj.endTime = endTime;   
        ht_obj.flgCal = flgCal;
         
     }   
    
    }